package com.sgb.kjwl.view.ui.activity.transport;

import android.content.Context;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.GridLayoutManager;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityGoodsInfoOrderPriceList3Binding;
import com.sgb.kjwl.di.transport.DaggerTransportComponent;
import com.sgb.kjwl.di.transport.TransportModule;
import com.sgb.kjwl.model.entity.transport.GoodsInfoEntity3;
import com.sgb.kjwl.view.ui.adapter.transport.GoodsInfoOrderPriceAdapter3;
import com.sgb.kjwl.viewmodel.transport.GoodsInfoOrderModel3;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;

import java.util.List;

import javax.inject.Inject;

public class GoodsInfoOrderPriceListActivity3 extends AppActivity {

    private ActivityGoodsInfoOrderPriceList3Binding binding;
    private GoodsInfoOrderPriceAdapter3 adapter;

    @Inject
    GoodsInfoOrderModel3 model;

    public static void start(Context context){
        Intent intent = new Intent(context,GoodsInfoOrderPriceListActivity3.class);
        context.startActivity(intent);
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerTransportComponent.builder().appComponent(appComponent).transportModule(new TransportModule(this)).build().inject(this);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(this, R.layout.activity_goods_info_order_price_list3);
        binding.include.ivBack.setOnClickListener(view -> finish());
        binding.include.titleView.setText("报价车主");

        binding.goodsInfoOrderList.setLayoutManager(new GridLayoutManager(this,1));
        adapter = new GoodsInfoOrderPriceAdapter3(this,null);
        binding.goodsInfoOrderList.setAdapter(adapter);
        adapter.setOnItemClick(new AdapterOnItemClick<GoodsInfoEntity3>() {
            @Override
            public void onItemClick(GoodsInfoEntity3 goodsInfoEntity3, int position) {

            }
        });
    }

    @Override
    protected void init() {
        model.getOrderList();
    }

    public void getOrderList(List<GoodsInfoEntity3> list){
        adapter.setDatas(list);
    }
}
